Optimal. Leaf size=366 \[ \frac {b^2 \left (31 a^2 B+49 a A b+18 b^2 B\right ) \sin (c+d x) \cos ^4(c+d x)}{105 d}+\frac {b \left (104 a^3 B+224 a^2 A b+140 a b^2 B+35 A b^3\right ) \sin (c+d x) \cos ^3(c+d x)}{168 d}-\frac {\left (35 a^4 B+140 a^3 A b+168 a^2 b^2 B+112 a A b^3+24 b^4 B\right ) \sin ^3(c+d x)}{105 d}+\frac {\left (35 a^4 B+140 a^3 A b+168 a^2 b^2 B+112 a A b^3+24 b^4 B\right ) \sin (c+d x)}{35 d}+\frac {\left (8 a^4 A+24 a^3 b B+36 a^2 A b^2+20 a b^3 B+5 A b^4\right ) \sin (c+d x) \cos (c+d x)}{16 d}+\frac {1}{16} x \left (8 a^4 A+24 a^3 b B+36 a^2 A b^2+20 a b^3 B+5 A b^4\right )+\frac {b (10 a B+7 A b) \sin (c+d x) \cos ^3(c+d x) (a+b \cos (c+d x))^2}{42 d}+\frac {b B \sin (c+d x) \cos ^3(c+d x) (a+b \cos (c+d x))^3}{7 d} \]
[Out]
________________________________________________________________________________________
Rubi [A] time = 0.84, antiderivative size = 366, normalized size of antiderivative = 1.00, number of steps used = 9, number of rules used = 8, integrand size = 31, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.258, Rules used = {2990, 3049, 3033, 3023, 2748, 2635, 8, 2633} \[ -\frac {\left (140 a^3 A b+168 a^2 b^2 B+35 a^4 B+112 a A b^3+24 b^4 B\right ) \sin ^3(c+d x)}{105 d}+\frac {\left (140 a^3 A b+168 a^2 b^2 B+35 a^4 B+112 a A b^3+24 b^4 B\right ) \sin (c+d x)}{35 d}+\frac {b^2 \left (31 a^2 B+49 a A b+18 b^2 B\right ) \sin (c+d x) \cos ^4(c+d x)}{105 d}+\frac {b \left (224 a^2 A b+104 a^3 B+140 a b^2 B+35 A b^3\right ) \sin (c+d x) \cos ^3(c+d x)}{168 d}+\frac {\left (36 a^2 A b^2+8 a^4 A+24 a^3 b B+20 a b^3 B+5 A b^4\right ) \sin (c+d x) \cos (c+d x)}{16 d}+\frac {1}{16} x \left (36 a^2 A b^2+8 a^4 A+24 a^3 b B+20 a b^3 B+5 A b^4\right )+\frac {b (10 a B+7 A b) \sin (c+d x) \cos ^3(c+d x) (a+b \cos (c+d x))^2}{42 d}+\frac {b B \sin (c+d x) \cos ^3(c+d x) (a+b \cos (c+d x))^3}{7 d} \]
Antiderivative was successfully verified.
[In]
[Out]
Rule 8
Rule 2633
Rule 2635
Rule 2748
Rule 2990
Rule 3023
Rule 3033
Rule 3049
Rubi steps
\begin {align*} \int \cos ^2(c+d x) (a+b \cos (c+d x))^4 (A+B \cos (c+d x)) \, dx &=\frac {b B \cos ^3(c+d x) (a+b \cos (c+d x))^3 \sin (c+d x)}{7 d}+\frac {1}{7} \int \cos ^2(c+d x) (a+b \cos (c+d x))^2 \left (a (7 a A+3 b B)+\left (6 b^2 B+7 a (2 A b+a B)\right ) \cos (c+d x)+b (7 A b+10 a B) \cos ^2(c+d x)\right ) \, dx\\ &=\frac {b (7 A b+10 a B) \cos ^3(c+d x) (a+b \cos (c+d x))^2 \sin (c+d x)}{42 d}+\frac {b B \cos ^3(c+d x) (a+b \cos (c+d x))^3 \sin (c+d x)}{7 d}+\frac {1}{42} \int \cos ^2(c+d x) (a+b \cos (c+d x)) \left (3 a \left (14 a^2 A+7 A b^2+16 a b B\right )+\left (126 a^2 A b+35 A b^3+42 a^3 B+104 a b^2 B\right ) \cos (c+d x)+2 b \left (49 a A b+31 a^2 B+18 b^2 B\right ) \cos ^2(c+d x)\right ) \, dx\\ &=\frac {b^2 \left (49 a A b+31 a^2 B+18 b^2 B\right ) \cos ^4(c+d x) \sin (c+d x)}{105 d}+\frac {b (7 A b+10 a B) \cos ^3(c+d x) (a+b \cos (c+d x))^2 \sin (c+d x)}{42 d}+\frac {b B \cos ^3(c+d x) (a+b \cos (c+d x))^3 \sin (c+d x)}{7 d}+\frac {1}{210} \int \cos ^2(c+d x) \left (15 a^2 \left (14 a^2 A+7 A b^2+16 a b B\right )+6 \left (140 a^3 A b+112 a A b^3+35 a^4 B+168 a^2 b^2 B+24 b^4 B\right ) \cos (c+d x)+5 b \left (224 a^2 A b+35 A b^3+104 a^3 B+140 a b^2 B\right ) \cos ^2(c+d x)\right ) \, dx\\ &=\frac {b \left (224 a^2 A b+35 A b^3+104 a^3 B+140 a b^2 B\right ) \cos ^3(c+d x) \sin (c+d x)}{168 d}+\frac {b^2 \left (49 a A b+31 a^2 B+18 b^2 B\right ) \cos ^4(c+d x) \sin (c+d x)}{105 d}+\frac {b (7 A b+10 a B) \cos ^3(c+d x) (a+b \cos (c+d x))^2 \sin (c+d x)}{42 d}+\frac {b B \cos ^3(c+d x) (a+b \cos (c+d x))^3 \sin (c+d x)}{7 d}+\frac {1}{840} \int \cos ^2(c+d x) \left (105 \left (8 a^4 A+36 a^2 A b^2+5 A b^4+24 a^3 b B+20 a b^3 B\right )+24 \left (140 a^3 A b+112 a A b^3+35 a^4 B+168 a^2 b^2 B+24 b^4 B\right ) \cos (c+d x)\right ) \, dx\\ &=\frac {b \left (224 a^2 A b+35 A b^3+104 a^3 B+140 a b^2 B\right ) \cos ^3(c+d x) \sin (c+d x)}{168 d}+\frac {b^2 \left (49 a A b+31 a^2 B+18 b^2 B\right ) \cos ^4(c+d x) \sin (c+d x)}{105 d}+\frac {b (7 A b+10 a B) \cos ^3(c+d x) (a+b \cos (c+d x))^2 \sin (c+d x)}{42 d}+\frac {b B \cos ^3(c+d x) (a+b \cos (c+d x))^3 \sin (c+d x)}{7 d}+\frac {1}{8} \left (8 a^4 A+36 a^2 A b^2+5 A b^4+24 a^3 b B+20 a b^3 B\right ) \int \cos ^2(c+d x) \, dx+\frac {1}{35} \left (140 a^3 A b+112 a A b^3+35 a^4 B+168 a^2 b^2 B+24 b^4 B\right ) \int \cos ^3(c+d x) \, dx\\ &=\frac {\left (8 a^4 A+36 a^2 A b^2+5 A b^4+24 a^3 b B+20 a b^3 B\right ) \cos (c+d x) \sin (c+d x)}{16 d}+\frac {b \left (224 a^2 A b+35 A b^3+104 a^3 B+140 a b^2 B\right ) \cos ^3(c+d x) \sin (c+d x)}{168 d}+\frac {b^2 \left (49 a A b+31 a^2 B+18 b^2 B\right ) \cos ^4(c+d x) \sin (c+d x)}{105 d}+\frac {b (7 A b+10 a B) \cos ^3(c+d x) (a+b \cos (c+d x))^2 \sin (c+d x)}{42 d}+\frac {b B \cos ^3(c+d x) (a+b \cos (c+d x))^3 \sin (c+d x)}{7 d}+\frac {1}{16} \left (8 a^4 A+36 a^2 A b^2+5 A b^4+24 a^3 b B+20 a b^3 B\right ) \int 1 \, dx-\frac {\left (140 a^3 A b+112 a A b^3+35 a^4 B+168 a^2 b^2 B+24 b^4 B\right ) \operatorname {Subst}\left (\int \left (1-x^2\right ) \, dx,x,-\sin (c+d x)\right )}{35 d}\\ &=\frac {1}{16} \left (8 a^4 A+36 a^2 A b^2+5 A b^4+24 a^3 b B+20 a b^3 B\right ) x+\frac {\left (140 a^3 A b+112 a A b^3+35 a^4 B+168 a^2 b^2 B+24 b^4 B\right ) \sin (c+d x)}{35 d}+\frac {\left (8 a^4 A+36 a^2 A b^2+5 A b^4+24 a^3 b B+20 a b^3 B\right ) \cos (c+d x) \sin (c+d x)}{16 d}+\frac {b \left (224 a^2 A b+35 A b^3+104 a^3 B+140 a b^2 B\right ) \cos ^3(c+d x) \sin (c+d x)}{168 d}+\frac {b^2 \left (49 a A b+31 a^2 B+18 b^2 B\right ) \cos ^4(c+d x) \sin (c+d x)}{105 d}+\frac {b (7 A b+10 a B) \cos ^3(c+d x) (a+b \cos (c+d x))^2 \sin (c+d x)}{42 d}+\frac {b B \cos ^3(c+d x) (a+b \cos (c+d x))^3 \sin (c+d x)}{7 d}-\frac {\left (140 a^3 A b+112 a A b^3+35 a^4 B+168 a^2 b^2 B+24 b^4 B\right ) \sin ^3(c+d x)}{105 d}\\ \end {align*}
________________________________________________________________________________________
Mathematica [A] time = 0.88, size = 408, normalized size = 1.11 \[ \frac {3360 a^4 A c+3360 a^4 A d x+560 a^4 B \sin (3 (c+d x))+2240 a^3 A b \sin (3 (c+d x))+840 a^3 b B \sin (4 (c+d x))+10080 a^3 b B c+10080 a^3 b B d x+1260 a^2 A b^2 \sin (4 (c+d x))+15120 a^2 A b^2 c+15120 a^2 A b^2 d x+4200 a^2 b^2 B \sin (3 (c+d x))+504 a^2 b^2 B \sin (5 (c+d x))+105 \left (48 a^4 B+192 a^3 A b+240 a^2 b^2 B+160 a A b^3+35 b^4 B\right ) \sin (c+d x)+105 \left (16 a^4 A+64 a^3 b B+96 a^2 A b^2+60 a b^3 B+15 A b^4\right ) \sin (2 (c+d x))+2800 a A b^3 \sin (3 (c+d x))+336 a A b^3 \sin (5 (c+d x))+1260 a b^3 B \sin (4 (c+d x))+140 a b^3 B \sin (6 (c+d x))+8400 a b^3 B c+8400 a b^3 B d x+315 A b^4 \sin (4 (c+d x))+35 A b^4 \sin (6 (c+d x))+2100 A b^4 c+2100 A b^4 d x+735 b^4 B \sin (3 (c+d x))+147 b^4 B \sin (5 (c+d x))+15 b^4 B \sin (7 (c+d x))}{6720 d} \]
Antiderivative was successfully verified.
[In]
[Out]
________________________________________________________________________________________
fricas [A] time = 1.60, size = 289, normalized size = 0.79 \[ \frac {105 \, {\left (8 \, A a^{4} + 24 \, B a^{3} b + 36 \, A a^{2} b^{2} + 20 \, B a b^{3} + 5 \, A b^{4}\right )} d x + {\left (240 \, B b^{4} \cos \left (d x + c\right )^{6} + 280 \, {\left (4 \, B a b^{3} + A b^{4}\right )} \cos \left (d x + c\right )^{5} + 1120 \, B a^{4} + 4480 \, A a^{3} b + 5376 \, B a^{2} b^{2} + 3584 \, A a b^{3} + 768 \, B b^{4} + 96 \, {\left (21 \, B a^{2} b^{2} + 14 \, A a b^{3} + 3 \, B b^{4}\right )} \cos \left (d x + c\right )^{4} + 70 \, {\left (24 \, B a^{3} b + 36 \, A a^{2} b^{2} + 20 \, B a b^{3} + 5 \, A b^{4}\right )} \cos \left (d x + c\right )^{3} + 16 \, {\left (35 \, B a^{4} + 140 \, A a^{3} b + 168 \, B a^{2} b^{2} + 112 \, A a b^{3} + 24 \, B b^{4}\right )} \cos \left (d x + c\right )^{2} + 105 \, {\left (8 \, A a^{4} + 24 \, B a^{3} b + 36 \, A a^{2} b^{2} + 20 \, B a b^{3} + 5 \, A b^{4}\right )} \cos \left (d x + c\right )\right )} \sin \left (d x + c\right )}{1680 \, d} \]
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
giac [A] time = 0.52, size = 313, normalized size = 0.86 \[ \frac {B b^{4} \sin \left (7 \, d x + 7 \, c\right )}{448 \, d} + \frac {1}{16} \, {\left (8 \, A a^{4} + 24 \, B a^{3} b + 36 \, A a^{2} b^{2} + 20 \, B a b^{3} + 5 \, A b^{4}\right )} x + \frac {{\left (4 \, B a b^{3} + A b^{4}\right )} \sin \left (6 \, d x + 6 \, c\right )}{192 \, d} + \frac {{\left (24 \, B a^{2} b^{2} + 16 \, A a b^{3} + 7 \, B b^{4}\right )} \sin \left (5 \, d x + 5 \, c\right )}{320 \, d} + \frac {{\left (8 \, B a^{3} b + 12 \, A a^{2} b^{2} + 12 \, B a b^{3} + 3 \, A b^{4}\right )} \sin \left (4 \, d x + 4 \, c\right )}{64 \, d} + \frac {{\left (16 \, B a^{4} + 64 \, A a^{3} b + 120 \, B a^{2} b^{2} + 80 \, A a b^{3} + 21 \, B b^{4}\right )} \sin \left (3 \, d x + 3 \, c\right )}{192 \, d} + \frac {{\left (16 \, A a^{4} + 64 \, B a^{3} b + 96 \, A a^{2} b^{2} + 60 \, B a b^{3} + 15 \, A b^{4}\right )} \sin \left (2 \, d x + 2 \, c\right )}{64 \, d} + \frac {{\left (48 \, B a^{4} + 192 \, A a^{3} b + 240 \, B a^{2} b^{2} + 160 \, A a b^{3} + 35 \, B b^{4}\right )} \sin \left (d x + c\right )}{64 \, d} \]
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
maple [A] time = 0.06, size = 368, normalized size = 1.01 \[ \frac {A \,a^{4} \left (\frac {\cos \left (d x +c \right ) \sin \left (d x +c \right )}{2}+\frac {d x}{2}+\frac {c}{2}\right )+\frac {a^{4} B \left (2+\cos ^{2}\left (d x +c \right )\right ) \sin \left (d x +c \right )}{3}+\frac {4 A \,a^{3} b \left (2+\cos ^{2}\left (d x +c \right )\right ) \sin \left (d x +c \right )}{3}+4 B \,a^{3} b \left (\frac {\left (\cos ^{3}\left (d x +c \right )+\frac {3 \cos \left (d x +c \right )}{2}\right ) \sin \left (d x +c \right )}{4}+\frac {3 d x}{8}+\frac {3 c}{8}\right )+6 A \,a^{2} b^{2} \left (\frac {\left (\cos ^{3}\left (d x +c \right )+\frac {3 \cos \left (d x +c \right )}{2}\right ) \sin \left (d x +c \right )}{4}+\frac {3 d x}{8}+\frac {3 c}{8}\right )+\frac {6 B \,a^{2} b^{2} \left (\frac {8}{3}+\cos ^{4}\left (d x +c \right )+\frac {4 \left (\cos ^{2}\left (d x +c \right )\right )}{3}\right ) \sin \left (d x +c \right )}{5}+\frac {4 A a \,b^{3} \left (\frac {8}{3}+\cos ^{4}\left (d x +c \right )+\frac {4 \left (\cos ^{2}\left (d x +c \right )\right )}{3}\right ) \sin \left (d x +c \right )}{5}+4 B a \,b^{3} \left (\frac {\left (\cos ^{5}\left (d x +c \right )+\frac {5 \left (\cos ^{3}\left (d x +c \right )\right )}{4}+\frac {15 \cos \left (d x +c \right )}{8}\right ) \sin \left (d x +c \right )}{6}+\frac {5 d x}{16}+\frac {5 c}{16}\right )+A \,b^{4} \left (\frac {\left (\cos ^{5}\left (d x +c \right )+\frac {5 \left (\cos ^{3}\left (d x +c \right )\right )}{4}+\frac {15 \cos \left (d x +c \right )}{8}\right ) \sin \left (d x +c \right )}{6}+\frac {5 d x}{16}+\frac {5 c}{16}\right )+\frac {B \,b^{4} \left (\frac {16}{5}+\cos ^{6}\left (d x +c \right )+\frac {6 \left (\cos ^{4}\left (d x +c \right )\right )}{5}+\frac {8 \left (\cos ^{2}\left (d x +c \right )\right )}{5}\right ) \sin \left (d x +c \right )}{7}}{d} \]
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
maxima [A] time = 0.39, size = 366, normalized size = 1.00 \[ \frac {1680 \, {\left (2 \, d x + 2 \, c + \sin \left (2 \, d x + 2 \, c\right )\right )} A a^{4} - 2240 \, {\left (\sin \left (d x + c\right )^{3} - 3 \, \sin \left (d x + c\right )\right )} B a^{4} - 8960 \, {\left (\sin \left (d x + c\right )^{3} - 3 \, \sin \left (d x + c\right )\right )} A a^{3} b + 840 \, {\left (12 \, d x + 12 \, c + \sin \left (4 \, d x + 4 \, c\right ) + 8 \, \sin \left (2 \, d x + 2 \, c\right )\right )} B a^{3} b + 1260 \, {\left (12 \, d x + 12 \, c + \sin \left (4 \, d x + 4 \, c\right ) + 8 \, \sin \left (2 \, d x + 2 \, c\right )\right )} A a^{2} b^{2} + 2688 \, {\left (3 \, \sin \left (d x + c\right )^{5} - 10 \, \sin \left (d x + c\right )^{3} + 15 \, \sin \left (d x + c\right )\right )} B a^{2} b^{2} + 1792 \, {\left (3 \, \sin \left (d x + c\right )^{5} - 10 \, \sin \left (d x + c\right )^{3} + 15 \, \sin \left (d x + c\right )\right )} A a b^{3} - 140 \, {\left (4 \, \sin \left (2 \, d x + 2 \, c\right )^{3} - 60 \, d x - 60 \, c - 9 \, \sin \left (4 \, d x + 4 \, c\right ) - 48 \, \sin \left (2 \, d x + 2 \, c\right )\right )} B a b^{3} - 35 \, {\left (4 \, \sin \left (2 \, d x + 2 \, c\right )^{3} - 60 \, d x - 60 \, c - 9 \, \sin \left (4 \, d x + 4 \, c\right ) - 48 \, \sin \left (2 \, d x + 2 \, c\right )\right )} A b^{4} - 192 \, {\left (5 \, \sin \left (d x + c\right )^{7} - 21 \, \sin \left (d x + c\right )^{5} + 35 \, \sin \left (d x + c\right )^{3} - 35 \, \sin \left (d x + c\right )\right )} B b^{4}}{6720 \, d} \]
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
mupad [B] time = 2.64, size = 436, normalized size = 1.19 \[ \frac {420\,A\,a^4\,\sin \left (2\,c+2\,d\,x\right )+\frac {1575\,A\,b^4\,\sin \left (2\,c+2\,d\,x\right )}{4}+140\,B\,a^4\,\sin \left (3\,c+3\,d\,x\right )+\frac {315\,A\,b^4\,\sin \left (4\,c+4\,d\,x\right )}{4}+\frac {35\,A\,b^4\,\sin \left (6\,c+6\,d\,x\right )}{4}+\frac {735\,B\,b^4\,\sin \left (3\,c+3\,d\,x\right )}{4}+\frac {147\,B\,b^4\,\sin \left (5\,c+5\,d\,x\right )}{4}+\frac {15\,B\,b^4\,\sin \left (7\,c+7\,d\,x\right )}{4}+1260\,B\,a^4\,\sin \left (c+d\,x\right )+\frac {3675\,B\,b^4\,\sin \left (c+d\,x\right )}{4}+4200\,A\,a\,b^3\,\sin \left (c+d\,x\right )+5040\,A\,a^3\,b\,\sin \left (c+d\,x\right )+840\,A\,a^4\,d\,x+525\,A\,b^4\,d\,x+700\,A\,a\,b^3\,\sin \left (3\,c+3\,d\,x\right )+560\,A\,a^3\,b\,\sin \left (3\,c+3\,d\,x\right )+84\,A\,a\,b^3\,\sin \left (5\,c+5\,d\,x\right )+1575\,B\,a\,b^3\,\sin \left (2\,c+2\,d\,x\right )+1680\,B\,a^3\,b\,\sin \left (2\,c+2\,d\,x\right )+315\,B\,a\,b^3\,\sin \left (4\,c+4\,d\,x\right )+210\,B\,a^3\,b\,\sin \left (4\,c+4\,d\,x\right )+35\,B\,a\,b^3\,\sin \left (6\,c+6\,d\,x\right )+6300\,B\,a^2\,b^2\,\sin \left (c+d\,x\right )+2520\,A\,a^2\,b^2\,\sin \left (2\,c+2\,d\,x\right )+315\,A\,a^2\,b^2\,\sin \left (4\,c+4\,d\,x\right )+1050\,B\,a^2\,b^2\,\sin \left (3\,c+3\,d\,x\right )+126\,B\,a^2\,b^2\,\sin \left (5\,c+5\,d\,x\right )+2100\,B\,a\,b^3\,d\,x+2520\,B\,a^3\,b\,d\,x+3780\,A\,a^2\,b^2\,d\,x}{1680\,d} \]
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
sympy [A] time = 8.20, size = 1017, normalized size = 2.78 \[ \text {result too large to display} \]
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________